﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class GameStart : MonoBehaviour 
{
    public Transform canvas;
    private Button btn_jiaoyu;
    private Button btn_tiyan;

    public AudioClip audioClip;
    void Awake()
    {
        btn_jiaoyu = canvas.Find("Btn_jiaoyu").GetComponent<Button>();
        btn_tiyan = canvas.Find("Btn_tiyan").GetComponent<Button>();
    }
	void Start () 
	{
        Invoke("LoadScene0",15f);
       
        Invoke("PlayBGMusic", 0.01f);

        btn_jiaoyu.onClick.AddListener(InitAsJiaoYuMode);
        btn_tiyan.onClick.AddListener(InitAsTiYanMode);

    }
	
    void LoadScene0()
    {
        MySceneManager.LoadScene("OverView");
    }


    void PlayBGMusic()
    {
        SoundManager.instance.PlayBGMusic(audioClip);
    }

    void InitAsJiaoYuMode()
    {
        PlayerPrefs.SetString("mode","教育模式");
        LoadScene0();
    }

    void InitAsTiYanMode()
    {
        PlayerPrefs.SetString("mode", "体验模式");
        LoadScene0();
    }
}
